Skip to content

Allow graphs to not be anonymous#128

Merged
dbaseqp merged 1 commit intomainfrom
non-anonymous-graph
Jan 29, 2026
Merged

Allow graphs to not be anonymous#128
dbaseqp merged 1 commit intomainfrom
non-anonymous-graph

Conversation

@dbaseqp
Copy link
Owner

@dbaseqp dbaseqp commented Jan 29, 2026

Fixes #125

Copilot AI review requested due to automatic review settings January 29, 2026 05:03
@dbaseqp dbaseqp merged commit fa25e97 into main Jan 29, 2026
14 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a feature to allow blue team members to view non-anonymized team names on score graphs, addressing issue #125. It adds a new configuration option AllowNonAnonymizedGraphsForBlueTeam that controls whether team names are displayed or anonymized to "Team" for non-admin users.

Changes:

  • Added new configuration field AllowNonAnonymizedGraphsForBlueTeam to control graph anonymization
  • Refactored duplicate anonymization logic into a shared shouldScrub function
  • Extended anonymization logic to the GetServiceStatus endpoint for consistency

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
engine/config/config.go Adds new boolean config field AllowNonAnonymizedGraphsForBlueTeam to UIConfig struct
www/api/graphs.go Refactors anonymization logic into shouldScrub helper function and applies it consistently across all three graph endpoints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


if shouldScrub(r) {
for i := range series {
series[i].Name = "Team"
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When scrubbing team names, the team ID is still exposed in the Series struct. This defeats the purpose of anonymization since clients can still identify teams by their IDs. Consider also scrubbing or removing the ID field when shouldScrub returns true, similar to how the Name field is scrubbed.

Suggested change
series[i].Name = "Team"
series[i].Name = "Team"
series[i].ID = 0

Copilot uses AI. Check for mistakes.
Comment on lines +220 to +229
if r.Context().Value("roles") != nil {
req_roles := r.Context().Value("roles").([]string)
if slices.Contains(req_roles, "admin") {
return false
}
}

if conf.UISettings.AllowNonAnonymizedGraphsForBlueTeam {
return false
}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation of AllowNonAnonymizedGraphsForBlueTeam affects all non-admin users, including red team members and anonymous users. Based on the config name and the issue description ("Add team numbers to score graphs for blue teams"), this setting should likely only apply to users with the "team" role. Consider checking for the "team" role before returning false here. For example: if the config is enabled AND the user has the "team" role, then don't scrub. This would prevent red team members and anonymous users from seeing team identities when they shouldn't.

Suggested change
if r.Context().Value("roles") != nil {
req_roles := r.Context().Value("roles").([]string)
if slices.Contains(req_roles, "admin") {
return false
}
}
if conf.UISettings.AllowNonAnonymizedGraphsForBlueTeam {
return false
}
rolesVal := r.Context().Value("roles")
if rolesVal != nil {
if reqRoles, ok := rolesVal.([]string); ok {
if slices.Contains(reqRoles, "admin") {
return false
}
if conf.UISettings.AllowNonAnonymizedGraphsForBlueTeam && slices.Contains(reqRoles, "team") {
return false
}
}
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add team numbers to score graphs for blue teams

1 participant